import router from '../router/index'
import userStorage from '@/utils/userStorage';

router.beforeEach((to, from, next) => {
    console.log(userStorage.getUserInfo())
    if (userStorage.getUserInfo()) {
        next();
    } else {
        console.log(to);
        console.log(to.path);
        if (to.name === 'ShoppingMall' || 
            to.name === 'CategoryList' || 
            to.name === 'Register' || 
            to.name === 'Login' ||
            to.name === 'Goods') {
            next();
        } else {
            next('/login');
        }
    }
});
